package it.asvp.asvp_portal.data.entity.member;

import it.asvp.asvp_portal.data.entity.domain.BaseEntity;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@SuppressWarnings("serial")
@Entity
@Table(name = "member_account_role", catalog = "asvp_db", uniqueConstraints = @UniqueConstraint(columnNames = { "id_member_account", "id_role" }))
public class MemberAccountRole extends BaseEntity {

  @ManyToOne(fetch = FetchType.EAGER)
  @JoinColumn(name = "id_role", nullable = false)
  private Role          role;

  @ManyToOne(fetch = FetchType.EAGER)
  @JoinColumn(name = "id_member_account", nullable = false)
  private MemberAccount memberAccount;

  public MemberAccountRole() {
  }

  public MemberAccountRole(Role role, MemberAccount memberAccount) {
    this.role = role;
    this.memberAccount = memberAccount;
  }

  public Role getRole() {
    return this.role;
  }

  public void setRole(Role role) {
    this.role = role;
  }

  public MemberAccount getMemberAccount() {
    return this.memberAccount;
  }

  public void setMemberAccount(MemberAccount memberAccount) {
    this.memberAccount = memberAccount;
  }

}
